package talib

import (
	"math"
)

func Avg(vals []float64) (float64) {
	if len(vals) == 0 {
		return math.NaN()
	}
	sum := 0.0
	for _, v := range vals {
		sum += v
	}
	return sum
}

func Max(vals []float64)  (float64){
	if len(vals) == 0 {
		return math.NaN()
	}
	max := vals[0]
	for _, v := range vals {
		if max < v {
			max = v
		}
	}
	return max
}

func Min(vals []float64) (float64){
	if len(vals) == 0 {
		return math.NaN()
	}
	min := vals[0]
	for _, v := range vals {
		if min > v {
			min = v
		}
	}
	return min
}
